package com.xgimi.open.skill.datamanager.web.controller;

import com.xgimi.open.skill.datamanager.biz.common.annotation.AutoLog;
import com.xgimi.open.skill.datamanager.biz.utils.RegularPatternUtil;
import com.xgimi.open.skill.datamanager.biz.vo.TestVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author coderzpw.zhang
 * @version 1.0
 * @description 描述
 * @date 2023/2/1 18:03
 */
@Slf4j
@RequestMapping("/test")
@RestController
public class TestController {


    @AutoLog
    @GetMapping("/hello")
    public Object hello() {
        log.info("打印日志");
        return "hello";
    }

    @GetMapping("/checkPattern")
    public Boolean checkPattern(@RequestBody TestVO data) {
        System.out.println("匹配内容为：" + data.getText());
        boolean flag = RegularPatternUtil.checkPattern(data.getText());
        if (flag) {
            System.out.println("成功");
        } else {
            System.out.println("成功");
        }
        return flag;
    }
}
